import request from '@/utils/request'

// 获取KPI模块列表
export function getKpiModuleList() {
  return request({
    url: '/operation/web/operationKpiModuleConfig/list',
    method: 'get'
  })
}

// 新增KPI模块
export function addKpiModule(data) {
  return request({
    url: '/operation/web/operationKpiModuleConfig',
    method: 'post',
    data
  })
}

// 修改KPI模块
export function updateKpiModule(data) {
  return request({
    url: '/operation/web/operationKpiModuleConfig',
    method: 'put',
    data
  })
}

// 删除KPI模块
export function deleteKpiModule(moduleConfigIds) {
  return request({
    url: `/operation/web/operationKpiModuleConfig/${moduleConfigIds}`,
    method: 'delete'
  })
}

// 获取KPI模块详情
export function getKpiModuleDetail(moduleConfigId) {
  return request({
    url: `/operation/web/operationKpiModuleConfig/${moduleConfigId}`,
    method: 'get'
  })
}

// 查询模块下的指标列表
export function getKpiListByModule(moduleConfigId) {
  return request({
    url: `/operation/web/operationKpiModuleConfig/listByModuleConfigId/${moduleConfigId}`,
    method: 'get'
  })
}

// 获取全部指标列表
export function getAllKpiList(params) {
  return request({
    url: '/operation/web/operationKpiModuleConfig/listAll',
    method: 'get',
    params
  })
}

// 添加指标到模块
export function addKpiToModule(data) {
  return request({
    url: '/operation/web/operationKpiModuleConfig/addKpiConfig',
    method: 'post',
    data
  })
}

// 删除模块下的指标
export function removeKpiFromModule(id) {
  return request({
    url: '/operation/web/operationKpiModuleConfig/removeMoudleConfigKpiConfig',
    method: 'delete',
    params: { id }
  })
}